On-Stack Replacement (OSR) is a technique for dynamically transferring execution between different versions of a function at run time. OSR is typically used in virtual machines to interrupt a long-running function and recompile it at a higher optimization level, or to replace it with a different one when a speculative assumption made during its compilation no longer holds. In this paper we present a framework for OSR that introduces novel ideas and combines features of existing techniques that no previous solution provided simultaneously. New features include OSR with compensation code to adjust the program state during a transition and the ability to fire an OSR from arbitrary locations in the code. Our approach is platform-independent as the OSR machinery is entirely encoded at a compiler’s intermediate representation level. We implement and evaluate our technique in the LLVM compiler infrastructure, which is gaining popularity as Just-In-Time (JIT) compiler in virtual machines for dynamic languages such as Javascript, MATLAB, Python, and Ruby. As a case study of our approach, we show how to improve the state of the art in the optimization of the feval instruction, a performance-critical construct of the MATLAB language.

Flexible On-Stack Replacement in LLVM / D'Elia, DANIELE CONO; Demetrescu, Camil. - STAMPA. - (2016), pp. 250-260. (Intervento presentato al convegno 14th Annual IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2016; Hotel Princesa SofiaBarcelona; Spain; 12 March 2016 through 18 March 2016; Code 119566 tenutosi a Barcelona; Spain nel March 2016) [10.1145/2854038.2854061].

Flexible On-Stack Replacement in LLVM

D'ELIA, DANIELE CONO
;
DEMETRESCU, Camil
2016

Abstract

On-Stack Replacement (OSR) is a technique for dynamically transferring execution between different versions of a function at run time. OSR is typically used in virtual machines to interrupt a long-running function and recompile it at a higher optimization level, or to replace it with a different one when a speculative assumption made during its compilation no longer holds. In this paper we present a framework for OSR that introduces novel ideas and combines features of existing techniques that no previous solution provided simultaneously. New features include OSR with compensation code to adjust the program state during a transition and the ability to fire an OSR from arbitrary locations in the code. Our approach is platform-independent as the OSR machinery is entirely encoded at a compiler’s intermediate representation level. We implement and evaluate our technique in the LLVM compiler infrastructure, which is gaining popularity as Just-In-Time (JIT) compiler in virtual machines for dynamic languages such as Javascript, MATLAB, Python, and Ruby. As a case study of our approach, we show how to improve the state of the art in the optimization of the feval instruction, a performance-critical construct of the MATLAB language.
2016
14th Annual IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2016; Hotel Princesa SofiaBarcelona; Spain; 12 March 2016 through 18 March 2016; Code 119566
On-stack replacement, just-in-time compilation, code optimization, deoptimization, LLVM
04 Pubblicazione in atti di convegno::04b Atto di convegno in volume
Flexible On-Stack Replacement in LLVM / D'Elia, DANIELE CONO; Demetrescu, Camil. - STAMPA. - (2016), pp. 250-260. (Intervento presentato al convegno 14th Annual IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2016; Hotel Princesa SofiaBarcelona; Spain; 12 March 2016 through 18 March 2016; Code 119566 tenutosi a Barcelona; Spain nel March 2016) [10.1145/2854038.2854061].
File allegati a questo prodotto
File Dimensione Formato  
DElia_Flexible-On-Stack_2016.pdf

solo gestori archivio

Tipologia: Versione editoriale (versione pubblicata con il layout dell'editore)
Licenza: Tutti i diritti riservati (All rights reserved)
Dimensione 506.11 kB
Formato Adobe PDF
506.11 kB Adobe PDF   Contatta l'autore
DElia_Frontespizio-indice_Flexible-On-Stack_2016.pdf

solo gestori archivio

Tipologia: Altro materiale allegato
Licenza: Tutti i diritti riservati (All rights reserved)
Dimensione 2.9 MB
Formato Adobe PDF
2.9 MB Adobe PDF   Contatta l'autore

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11573/840087
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 13
  • ???jsp.display-item.citation.isi??? 10
social impact